package com.empty_pro.newone;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import androidx.annotation.NonNull;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

public class MyAdapter extends ArrayAdapter {


    public MyAdapter(Context context, int resource, ArrayList<HashMap<String,String>> list) {
        super(context, resource,list);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent){
        View itemView=convertView;
        if(itemView==null){
            itemView= LayoutInflater.from(getContext()).inflate(R.layout.list_item,parent,false);
        }
        Map<String,String> map=(Map<String,String>) getItem(position);
        TextView detail=(TextView) itemView.findViewById(R.id.rate);
        TextView title=(TextView) itemView.findViewById(R.id.name);

        title.setText(map.get("key"));
        detail.setText(map.get("val"));
        return itemView;
    }



}


/*
public View getView(int position, View convertView, ViewGroup parent){
    View itemView=convertView;
    if(itemView==null){
        itemView= LayoutInflater.from(getContext()).inflate(R.layout.list_item,parent,false);
    }
    Map<String,String> map=(Map<String,String>) getItem(position);
    TextView title=(TextView) itemView.findViewById(R.id.name);
    TextView detail=(TextView) itemView.findViewById(R.id.rate);

    title.setText("Title"+map.get("ItemTitle"));
    title.setText("Detail"+map.get("ItemDetail"));
    return itemView;
}

 */
